package com.example.edu.Controller;

import com.example.edu.Dto.PageDto;
import com.example.edu.Dto.PictureUploadDto;
import com.example.edu.Dto.Result;
import com.example.edu.Entity.Picture;
import com.example.edu.Service.PictureService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin/picture")
public class PictureController {
    @Resource
    PictureService pictureService;

    @PostMapping("/upload")
    public Result upload(@RequestHeader("Authorization") String token, @RequestBody PictureUploadDto pictureUploadDto){
        return pictureService.upload(token,pictureUploadDto);
    }

    @PostMapping("/getList")
    public Result getList(@RequestHeader("Authorization") String token, @RequestBody PageDto pageDto){
        return pictureService.getList(token,pageDto);
    }

    @PostMapping("/delete")
    public Result delete(@RequestHeader("Authorization") String token, @RequestBody Picture picture_id){
        return pictureService.delete(token,picture_id);
    }

    @PostMapping("/selectRelationArticle")
    public Result selectRelationArticle(@RequestHeader("Authorization") String token, @RequestBody Picture picture_id){
        return pictureService.selectRelationArticle(token,picture_id);
    }
}
